const {Config} = require("./config");
const {ipcMain, app} = require('electron')
const {createRest} = require("./window")

let window

/**
 * 设置休息弹窗
 */
function setRest() {
    ipcMain.on("close_reset", (event, args) => {
        if (window !== null) {
            app.hide();
            window.close()
        }
    })
    // 20分钟展示一次
    setInterval(() => {
        if (Config.pauseTips) {
            return;
        }
        window = createRest();
    }, 1000 * 60 * Config.sleepT)
}

exports.setRest = setRest
exports.restWindow =window